//package com.tree.common.config.redis;
//
//import org.springframework.boot.context.properties.EnableConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
//import org.springframework.data.redis.connection.jedis.JedisClientConfiguration;
//import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
//import redis.clients.jedis.JedisPoolConfig;
//
///**
// * @ClassName com.demo.common.config.redis
// * Description: <类功能描述>. <br>
// * <p>
// * <使用说明>
// * </p>
// * @Author tree
// * @Date 2019-05-25 21:15
// * @Version 1.0
// */
//@Configuration
//@EnableConfigurationProperties({JedisRedisProperties.class})
//public class JedisRedisConfig {
//
//    @Bean
//    JedisConnectionFactory jedisConnectionFactory (JedisRedisProperties jedisRedisProperties, JedisClientConfiguration jedisClientConfiguration){
//        RedisStandaloneConfiguration configuration = new RedisStandaloneConfiguration(jedisRedisProperties.getHostName());
//        configuration.setPassword(jedisRedisProperties.getPassword());
//        JedisConnectionFactory connectionFactory = new JedisConnectionFactory(configuration,jedisClientConfiguration);
//        return connectionFactory;
//    }
//
//    @Bean
//    public JedisClientConfiguration jedisClientConfiguration(JedisPoolConfig jedisPoolConfig){
//        JedisClientConfiguration.JedisClientConfigurationBuilder builder = JedisClientConfiguration.builder();
//        builder.usePooling().poolConfig(jedisPoolConfig);
//        return builder.build();
//    }
//
//    @Bean
//    public JedisPoolConfig jedisPoolConfig (JedisRedisProperties jedisRedisProperties){
//        JedisPoolConfig config = new JedisPoolConfig();
//        config.setMaxTotal(jedisRedisProperties.getMaxTotal());
//        config.setMaxIdle(jedisRedisProperties.getMaxIdle());
//        config.setTestOnBorrow(jedisRedisProperties.getTestOnBorrow());
//        return config;
//    }
//}
